package cn.hema.Client;

import cn.hema.model.Book;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
/**
 * 商品服务远程调用客户端
 */
@FeignClient(name="book-service", fallback=BookServiceFallback.class)
public interface BookServiceClient {

    @GetMapping("/{id}")
    Book findById(@RequestParam("id") Long id);

    @PostMapping
    void addBook(@RequestBody Book book);

    @DeleteMapping("/{id}")
    void deleteBook(@PathVariable("id") Long id);

    @PutMapping("/{id}")
    void updateBook(
            @PathVariable("id") Long id,
            @RequestBody Book book);

    @GetMapping
    List<Book> getAllBooks();
}